<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../react18/react.development.js"></script>
    <script src="../react18/react-dom.development.js"></script>
    <script src="../react18/babel.min.js"></script>
  </head>
  <body>
    <div id="app"></div>
    <script type="text/babel">
      /* 
      不使用ref的情况:
        * 需求:当某个元素上发生事件的时候,想要获取当前元素的真实DOM
        * 我们只需要通过event事件对象 中的 target属性即可获取
    */
      class App extends React.Component {
        render() {
          return (
            <div>
              <h1>当input数去焦点的时候 打印元素中的内容</h1>
              <input type="text" onBlur={this.iptBlur} />
            </div>
          );
        }
        iptBlur = (e) => {
          console.log(e);
          console.log(e.target);
          console.log(e.target.value);
        };
      }
      ReactDOM.createRoot(document.getElementById("app")).render(<App />);
    </script>
  </body>
</html>
